<?php 
    namespace Application\Form;
    
    use Zend\Form\Form;
    class UserForm extends Form{
        public function __construct($name = null){
            parent::__construct('user');
            $this->setAttribute('method', 'post');
            $this->setAttribute('enctype','multipart/form-data');
            $this->add(array(
                'name' => 'uid',
                'attributes' => array(
                    'type'  => 'hidden',
                ),
                'options' => array(
                    'id'  => 'uid',
                    'label'  => "No",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'libelle',
                'attributes' => array(
                    'type'  => 'text',
                ),
                'options' => array(
                    'id'  => 'libelle',
                    'label'  => "Libellé",
                ),
                'filters' => array(
                    array(
                        'name' => 'StringTrim'
                    )
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'photo',
                'attributes' => array(
                    'type'  => 'text',
                ),
                'options' => array(
                    'id'  => 'photo',
                    'label'  => "Photo",
                ),
                'filters' => array(
                    array(
                        'name' => 'StringTrim'
                    )
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'date_creation',
                'attributes' => array(
                    'type'  => 'Zend\Form\Element\Date',
                ),
                'options' => array(
                    'id'  => 'date_creation',
                    'label'  => "Date création",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'id_createur',
                'attributes' => array(
                    'type'  => 'Zend\Form\Element\Number',
                ),
                'options' => array(
                    'id'  => 'id_createur',
                    'label'  => "Id créateur",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'id_modificateur',
                'attributes' => array(
                    'type'  => 'Zend\Form\Element\Number',
                ),
                'options' => array(
                    'id'  => 'id_modificateur',
                    'label'  => "Id modificateur",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'date_modification',
                'attributes' => array(
                    'type'  => 'Zend\Form\Element\Date',
                ),
                'options' => array(
                    'id'  => 'date_modification',
                    'label'  => "Date modification",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'statut',
                'type'  => 'Zend\Form\Element\Radio',
                'options' => array(
                    'label' => "Statut : ",
                    'value_options' => array(
                        '1' => 'Yes',
                        '0' => 'No',
                    ),
                )
            ));
            $this->add(array(
                'name' => 'hits',
                'attributes' => array(
                    'type'  => 'Zend\Form\Element\Number',
                ),
                'options' => array(
                    'id'  => 'hits',
                    'label'  => "Hits",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'email',
                'attributes' => array(
                    'type'  => 'email',
                ),
                'options' => array(
                    'id'  => 'email',
                    'label'  => "Email",
                ),
                'filters' => array(
                    array(
                        'name' => 'StringTrim'
                    )
                ),
                'validators' => array(
                    array(
                        'name' => 'EmailAddress',
                        'options' => array(
                            'messages' => array(\Zend\Validator\EmailAddress::INVALID_FORMAT =>'Email is not an correct email')
                        )
                    )
                ),
            ));
            $this->add(array(
                'name' => 'mot_de_passe',
                'attributes' => array(
                    'type'  => 'text',
                ),
                'options' => array(
                    'id'  => 'mot_de_passe',
                    'label'  => "Mot de passe",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'niveau_acces',
                'attributes' => array(
                    'type'  => 'Zend\Form\Element\Number',
                ),
                'options' => array(
                    'id'  => 'niveau_acces',
                    'label'  => "Niveau d'accès",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'code',
                'attributes' => array(
                    'type'  => 'text',
                ),
                'options' => array(
                    'id'  => 'code',
                    'label'  => "Code activation",
                ),
                'filters' => array(
                    array(
                        'name' => 'StringTrim'
                    )
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'date_code',
                'attributes' => array(
                    'type'  => 'Zend\Form\Element\Date',
                ),
                'options' => array(
                    'id'  => 'date_code',
                    'label'  => "Date de génération du code activation",
                ),
                'validators' => array(
                ),
            ));
            $this->add(array(
                'name' => 'submit',
                'attributes' => array(
                    'type'  => 'submit',
                    'value' => 'Submit',
                    'id' => 'submitbutton',
                ),
            ));
        }
    }
